package com.kafka.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.springframework.kafka.listener.KafkaListenerErrorHandler;
import org.springframework.kafka.listener.ListenerExecutionFailedException;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ErrorListener implements KafkaListenerErrorHandler {


    @Override
    public Object handleError(Message<?> message, ListenerExecutionFailedException exception, Consumer<?, ?> consumer) {
    	log.error("handleError1: {}", message.toString());
        exception.printStackTrace();
        return null;
    }

    @Override
    public Object handleError(Message<?> message, ListenerExecutionFailedException e) {
        log.error("handleError2: {}", message.toString());
        return null;
    }




}
